<template>
    <div class="back">
        <div class="card">

            <h3>姓名:{{ user.name }}性别:{{ user.gender }} 单位:{{ user.unit }}
                职务:{{ user.position }}职务级别:{{ user.level }}</h3>

            <div class="title">政治素质</div>

            <div class="formitem">
                <el-form :inline="true" label-width="100">
                    <el-form-item label="理想信念表现" style="width: 30%;">
                        <el-input placeholder="请输入" v-model="form.zhengzhi1" @input="input1"></el-input>
                    </el-form-item>
                    <el-form-item label="思想政治表现" style="width: 30%;">
                        <el-input placeholder="请输入" v-model="form.zhengzhi2"></el-input>
                    </el-form-item>
                    <el-form-item label="道德表现" style="width: 30%;">
                        <el-input placeholder="请输入" v-model="form.zhengzhi3"></el-input>
                    </el-form-item>
                </el-form>


            </div>
            <div class="title">职业操守</div>

            <div class="formitem">
                <el-form :inline="true" label-width="100">
                    <el-form-item label="敬业精神" style="width: 30%;">
                        <el-input placeholder="请输入" v-model="form.zhiye1"></el-input>
                    </el-form-item>
                    <el-form-item label="职业道德" style="width: 30%;">
                        <el-input placeholder="请输入" v-model="form.zhiye2"></el-input>
                    </el-form-item>
                    <el-form-item label="职业素质" style="width: 30%;">
                        <el-input placeholder="请输入" v-model="form.zhiye3"></el-input>
                    </el-form-item>
                </el-form>


            </div>
            <div class="title">作风建设</div>

            <div class="formitem">
                <el-form :inline="true" label-width="100">
                    <el-form-item label="纪律表现" style="width: 30%;">
                        <el-input placeholder="请输入" v-model="form.zuofeng1"></el-input>
                    </el-form-item>
                    <el-form-item label="政治素养" style="width: 30%;">
                        <el-input placeholder="请输入" v-model="form.zuofeng2"></el-input>
                    </el-form-item>
                    <el-form-item label="联系群众" style="width: 30%;">
                        <el-input placeholder="请输入" v-model="form.zuofeng3"></el-input>
                    </el-form-item>
                </el-form>


            </div>
            <div class="title">廉洁从业</div>

            <div class="formitem">
                <el-form :inline="true" label-width="100">
                    <el-form-item label="遵纪守法" style="width: 30%;">
                        <el-input placeholder="请输入" v-model="form.lianjie1"></el-input>
                    </el-form-item>
                    <el-form-item label="工作纪律" style="width: 30%;">
                        <el-input placeholder="请输入" v-model="form.lianjie2"></el-input>
                    </el-form-item>
                    <el-form-item label="政治纪律" style="width: 30%;">
                        <el-input placeholder="请输入" v-model="form.lianjie3"></el-input>
                    </el-form-item>
                </el-form>


            </div>
            <div class="title">团队精神</div>

            <div class="formitem">
                <el-form :inline="true" label-width="100">
                    <el-form-item label="团队总结" style="width: 30%;">
                        <el-input placeholder="请输入" v-model="form.tuandui1"></el-input>
                    </el-form-item>
                    <el-form-item label="团队学习" style="width: 30%;">
                        <el-input placeholder="请输入" v-model="form.tuandui2"></el-input>
                    </el-form-item>
                    <el-form-item label="团队精神" style="width: 30%;">
                        <el-input placeholder="请输入" v-model="form.tuandui3"></el-input>
                    </el-form-item>
                </el-form>
                <el-divider></el-divider>
                <el-input type="textarea" placeholder="其他意见" v-model="form.otherOpinions"> </el-input>
                <el-button type="primary" style="width: 100%;margin-top: 10px;" @click="sub">提交</el-button>

            </div>
        </div>
    </div>
</template>
<script>
import service from '@/request'

export default {
    data() {
        return {
            form: {
                zhengzhi1: "",
                zhengzhi2: "",
                zhengzhi3: "",
                zhiye1: "",
                zhiye2: "",
                zhiye3: "",
                zuofeng1: "",
                zuofeng2: "",
                zuofeng3: "",
                lianjie1: "",
                lianjie2: "",
                lianjie3: "",
                tuandui1: "",
                tuandui2: "",
                tuandui3: "",

            },
            user: {}
        }
    },
    async mounted() {
        const res1 = await service.get("/evaluationUser/getUserByLoginCode/" + this.$route.query.id);
        console.log(res1, "123")
        window.localStorage.setItem("userinfo", JSON.stringify(res1.data))
        this.user = JSON.parse(window.localStorage.getItem("userinfo"))
        console.log(this.user)
        this.form.loginCode=this.user.username
        this.form.evaluationId=this.user.evaluationId
        this.form.evaluationUserId=this.user.id
    },
    methods: {
        async sub() {
            this.form.scoreSum = 0;
            this.form.scoreSum = Number(this.form.zhengzhi1) + Number(this.form.zhengzhi2) + Number(this.form.zhengzhi3) + Number(this.form.zhiye1) + Number(this.form.zhiye2) + Number(this.form.zhiye3) + Number(this.form.zuofeng1) + Number(this.form.zuofeng2) + Number(this.form.zuofeng3) + Number(this.form.lianjie1) + Number(this.form.lianjie2) + Number(this.form.lianjie3) + Number(this.form.tuandui1) + Number(this.form.tuandui2) + Number(this.form.tuandui3);
            const res = await service.post("/evaluationContent", this.form);
            console.log(res)
            this.$message.success({
                title: "提交成功"
            })
        },

        input1() {
            this.$forceUpdate()
        }
    }
}
</script>
<style>
.formitem .el-form {
    width: 100%;
}
</style>
<style scoped>
.formitem {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
}

.title {
    color: #000;
    margin-bottom: 10px;
    font-weight: bold;

}

.card {
    width: 100%;
    height: auto;
    padding: 10px;
    box-sizing: border-box;
    background: #fff;
}

.back {
    padding: 10px;
    width: 100%;
    height: auto;
    background: #e5e5e5;
    box-sizing: border-box;

}
</style>